package com.siyuan.sns.admin.dao.impl;

import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.siyuan.sns.admin.dao.AdminDao;
import com.siyuan.sns.admin.domain.entity.Admin;
import com.siyuan.sns.utils.dao.BaseDao;

@Repository("adminDao")
public class AdminDaoImpl extends BaseDao implements AdminDao {

	@Override
	public Admin findByUsername(String username) {
		Session session = this.getSession();
		return (Admin) session.createCriteria(Admin.class)
				.add(Restrictions.eq("username", username)).uniqueResult();
	}

}
